//
//  ArrowView.m
//  LightControl
//
//  Created by CKF on 2025/8/11.
//

#import "ArrowView.h"

@implementation ArrowView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor whiteColor];
        UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
        [self addSubview:btn1];
        btn1.tag = 1;
        btn1.frame = CGRectMake(20, 10, frame.size.width-20, 44);
        [btn1 setTitle:@"zh" forState:0];
        btn1.titleLabel.font = [UIFont systemFontOfSize:17];
        [btn1 setTitleColor:[UIColor blackColor] forState:0];
        [btn1 addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
        btn1.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
        
        UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeCustom];
        [self addSubview:btn2];
        btn2.tag = 2;
        btn2.frame = CGRectMake(20, 54, frame.size.width-20, 44);
        [btn2 setTitle:@"en" forState:0];
        btn2.titleLabel.font = [UIFont systemFontOfSize:17];
        [btn2 setTitleColor:[UIColor blackColor] forState:0];
        [btn2 addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
        btn2.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    }
    
    return self;
}

-(void)btnClick:(UIButton *)btn{
    if (_callBack) {
        _callBack(btn.tag == 1?@"zh":@"en");
    }
}
@end
